package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.PopulationMoveBean;
import com.sx.zongzhi.bean.PopulationMoveSearchBean;
import com.sx.zongzhi.modle.CollectManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IPopMoveView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *获取流动人员列表
 */
public class PopMovePest {

    private IPopMoveView moveView;

    public PopMovePest(IPopMoveView moveView) {
        this.moveView=moveView;
    }


    /**
     *
     * @param orgId 网格id
     * @param page 当前页
     * @param rows 当前行
     */
    public void getPopMoveList(String orgId, PopulationMoveSearchBean searchBean, int page, int rows){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("searchVo.orgId", orgId);
        if (searchBean!=null){
            map.put("searchVo.name", searchBean.getName());
            map.put("searchVo.idCardNo", searchBean.getIdCardNo());
            map.put("searchVo.currentAddress", searchBean.getCurrentAddress());
            map.put("searchVo.logOut", searchBean.getLogOut());
            map.put("searchVo.isDeath", searchBean.getIsDeath());
            map.put("searchVo.gender", searchBean.getGender());
            map.put("searchVo.nation", searchBean.getNation());
            map.put("searchVo.maritalState", searchBean.getMaritalState());
            map.put("searchVo.politicalBackground",searchBean.getPoliticalBackground());
            map.put("searchVo.schoolStr",searchBean.getSchoolStr());
            map.put("searchVo.inflowingReason", searchBean.getReason());
            map.put("searchVo.isResident", searchBean.getFixed());
            map.put("searchVo.registerStartDate",searchBean.getRegStartTime());
            map.put("searchVo.registerEndDate", searchBean.getRegEndTime());
            map.put("searchVo.expectedStartDatedue", searchBean.getCredStartTime());
            map.put("searchVo.expectedEndDatedue",searchBean.getCredEndTime());
            map.put("searchVo.startBirthday", searchBean.getBirthday());
            map.put("searchVo.endBirthday", searchBean.getEndBirthday());
        }
        map.put("page",page);
        map.put("rows", rows);

        new CollectManager().getPopMoveList(map, new BaseCallBack<BaseResult<PopulationMoveBean>>() {
            @Override
            public void onSuccess(BaseResult<PopulationMoveBean> response) {
                moveView.getPopMoveList(response.getData());
            }
            @Override
            public void onFailures(String message) {
                moveView.showError(message);
            }
        });
    }

}
